#include <my_header.h>

/* Usage: ./10_pthread_exit3_主动退出.c主动退出 */
// 如果子线程通过pthread_exit(NULL) 退出, 那么pthread_join()捕获的线程退出状态和 return 0以及pthread_exit(0) 结束线程一样,捕获返回结果为0。
void *funThread(void *arg){
    //pthread_exit(NULL);
    //pthread_exit(0);
    return 0;    
} 
int main()
{
    pthread_t threadId;
    int ret = pthread_create(&threadId, NULL, funThread, NULL);
    THREAD_ERROR_CHECK(ret, "pthread_create");

    void *numP;
    int ret_join = pthread_join(threadId, &numP);
    THREAD_ERROR_CHECK(ret_join, "pthread_join");

    printf("catch child thread by pthread_exit value = %ld \n", (long)numP);
    return 0;
}

